<template>
	<view class="withdrawal-detail" v-if="withdrawalDetail">
		<common-navbar title="提现详情"></common-navbar>
		<view class="withdrawal-detail-top">
			<view class="user-avatar-wrapper">
				<u-image width="100%" height="100%" :src="withdrawalDetail.avatars" border-radius="50%"></u-image>
			</view>
			<view class="withdrawal-title">
				提现金额(元)
			</view>
			<view class="withdrawal-amount">
				<text style="font-size: 22rpx;">￥</text>{{withdrawalDetail.amount}}
			</view>
		</view>
		<view class="withdrawal-detail-list">
			<!-- 到账类型 start -->
			<view class="withdrawal-detail-item">
				<view class="label">
					到账类型：
				</view>
				<view class="value">
					{{withdrawalDetail.withdraw_type == 1?'提现至余额':withdrawalDetail.withdraw_type == 2?'提现至微信':'私下返款'}}
				</view>
			</view>
			<!-- 到账类型 end -->
			<!-- 当前状态 start -->
			<view class="withdrawal-detail-item">
				<view class="label">
					当前状态：
				</view>
				<view class="value" :class="withdrawalDetail.status==1?'pending':withdrawalDetail.status==2?'success':'error'">
					{{withdrawalDetail.status==1?'待处理':withdrawalDetail.status==2?'审核成功':'审核失败'}}
				</view>
			</view>
			<!-- 当前状态 end -->
			<!-- 工单编号 start -->
			<view class="withdrawal-detail-item">
				<view class="label">
					工单编号：
				</view>
				<view class="value">
					{{withdrawalDetail.task_code}}
				</view>
			</view>
			<!-- 工单编号 end -->
			<!-- 申请时间 start -->
			<view class="withdrawal-detail-item">
				<view class="label">
					申请时间：
				</view>
				<view class="value">
					{{withdrawalDetail.created_at}}
				</view>
			</view>
			<!-- 申请时间 end -->
			<!-- 到账时间 start -->
			<view class="withdrawal-detail-item" v-if="withdrawalDetail.check_time">
				<view class="label">
					审核时间：
				</view>
				<view class="value">
					{{withdrawalDetail.check_time}}
				</view>
			</view>
			<!-- 到账时间 end -->
			<!-- 到账凭证 start -->
			<view class="withdrawal-detail-item" v-if="withdrawalDetail.certificate">
				<view class="label">
					到账凭证：
				</view>
				<view class="value">
					<u-image :src="withdrawalDetail.certificate" width="60rpx" height="60rpx" mode="widthFix" @click="previewImage"/>
				</view>
			</view>
			<!-- 到账凭证 end -->
			<!-- 备注 start -->
			<view class="withdrawal-detail-item">
				<view class="label">
					备注：
				</view>
				<view class="value" style="font-weight: 400;color: #E93C3C;">
					{{withdrawalDetail.fail_reason||'平台审核需要2-3天，请您耐心等待。'}}
				</view>
			</view>
			<!-- 备注 end -->
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				withdrawalDetail:null,
			}
		},
		async onLoad(options){
			await this.$loginStatus;
			const wid = options.id;
			const {data} = await this.$u.post(this.$restUrl.getWithdrawalDetail,{
				wid
			})
			this.withdrawalDetail = data;
			console.log('this.withdrawalDetail>>>>>>>>>>>>>>',this.withdrawalDetail);
		},
		methods:{
			previewImage(url){
				uni.previewImage({
					urls: [url],
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	@import "./withdrawalDetail.scss";
</style>
